using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_Bill_BAL_PAT_TFMap : EntityTypeConfiguration<SO_Bill_BAL_PAT_TF>
    {
        public SO_Bill_BAL_PAT_TFMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Type, t.DATE, t.PATIENT_AMOUNT, t.BILL_CURRENCY, t.currency });

            // Properties
            this.Property(t => t.Bill__)
                .HasMaxLength(8);

            this.Property(t => t.Type)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(1);

            this.Property(t => t.PATIENT)
                .HasMaxLength(80);

            this.Property(t => t.PATIENT__)
                .HasMaxLength(6);

            this.Property(t => t.BILL_CURRENCY)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.Document__)
                .HasMaxLength(8);

            this.Property(t => t.currency)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("SO_Bill_BAL_PAT_TF");
            this.Property(t => t.Bill__).HasColumnName("Bill_#");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.closed).HasColumnName("closed");
            this.Property(t => t.PATIENT).HasColumnName("PATIENT");
            this.Property(t => t.PATIENT__).HasColumnName("PATIENT_#");
            this.Property(t => t.PATIENT_AMOUNT).HasColumnName("PATIENT_AMOUNT");
            this.Property(t => t.BILL_CURRENCY).HasColumnName("BILL_CURRENCY");
            this.Property(t => t.Document__).HasColumnName("Document_#");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.Patient_balance).HasColumnName("Patient_balance");
        }
    }
}
